package com.wan.personnel2.web.controller;


import com.wan.personnel2.entity.DeptInf;
import com.wan.personnel2.entity.ResultCode;
import com.wan.personnel2.service.DeptInfService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.security.NoSuchAlgorithmException;

@Controller
@RequestMapping("/deptInf")
public class DeptInfController {

    @Autowired
    private DeptInfService service;

    @RequestMapping("/getAll")
    @ResponseBody
    public ResultCode<DeptInf> getDept(){
        ResultCode<DeptInf> rc = service.getDept();
        return rc;
    }


    @RequestMapping("/add")
    @ResponseBody
    public boolean addDept(@RequestBody DeptInf user) throws NoSuchAlgorithmException {
        boolean ans = service.addDeptInf(user);
        return ans;
    }


}




